package com.qf.tms.controller;

import com.qf.tms.entity.Classroom;
import com.qf.tms.service.ClassroomService;
import com.qf.tms.util.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "教室功能接口")
public class ClassroomController {

    @Autowired
    private ClassroomService classroomService;

    @GetMapping("/classroom/{cid}")
    @ApiOperation(value = "根据cid查找教室信息")
    public R findClassroomById(@PathVariable int cid){

        Classroom classroom = classroomService.findClassroomById(cid);
        if (classroom!=null){
            return R.success(classroom);
        }else {
            return R.fail();
        }

    }
}
